// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IInstrumentExpoCell.cs" company="Open Trader">
//   Copyright (c) David Denis (david.denis@systemathics.com)
// </copyright>
// <summary>
//   |  Open Trader - The Open Source Systematic Trading Platform
//   |
//   |  This program is free software: you can redistribute it and/or modify
//   |  it under the terms of the GNU General Public License as published by
//   |  the Free Software Foundation, either version 2 of the License, or
//   |  (at your option) any later version.
//   |
//   |  This program is distributed in the hope that it will be useful,
//   |  but WITHOUT ANY WARRANTY; without even the implied warranty of
//   |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   |  GNU General Public License for more details.
//   |
//   |  You should have received a copy of the GNU General Public License
//   |  along with this program.  If not, see http://www.gnu.org/licenses
//   |
//   |  Up to date informations about Open Trader can be found at :
//   |    http://opentrader.org
//   |    http://opentrader.codeplex.com
//   |
//   |  For professional services, please visit us at :
//   |    http://www.systemathics.com
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Org.OpenTrader.Framework.Forge.Interfaces
{
    #region Usings

    using System;

    using Org.OpenTrader.Framework.Forge.Enums;
    using Org.OpenTrader.Framework.Forge.Events;

    #endregion

    /// <summary>
    /// The i instrument expo cell.
    /// </summary>
    public interface IInstrumentExpoCell : IExpoCell
    {
        #region Events

        /// <summary>
        /// The order event handler.
        /// </summary>
        event EventHandler<OrderEventArgs> OrderEventCB;

        #endregion

        #region Properties

        /// <summary>
        /// Gets the average price of the inventory
        /// </summary>
        double AveragePrice { get; }

        /// <summary>
        /// Average price of executed buy orders
        /// </summary>
        double BuyAverageExecutedPrice { get; }

        /// <summary>
        /// Cumulative quantity of executed buy orders
        /// </summary>
        int BuyExecutedQty { get; }

        /// <summary>
        /// Gets the total executed qty : BuyExecutedQty + SellExecutedQty
        /// </summary>
        int ExecutedQty { get; }

        /// <summary>
        /// Gets Expo Type
        /// </summary>
        EExpoCellType ExpoType { get; }

        /// <summary>
        /// Gets FactorPrice
        /// </summary>
        double FactorPrice { get; }

        /// <summary>
        /// Gets Fees
        /// </summary>
        double Fees { get; }

        /// <summary>
        /// Gets FeesTracker.
        /// </summary>
        IFeesTracker FeesTracker { get; }

        /// <summary>
        /// Gets or sets Instrument.
        /// </summary>
        IInstrument Instrument { get; }

        /// <summary>
        /// Gets the inventory : BuyExecutedQty - SellExecutedQty
        /// </summary>
        int Inventory { get; }

        /// <summary>
        /// Check if the vales are changed
        /// </summary>
        bool IsChanged { get; }

        /// <summary>
        /// TRUE if no position are open on this symbol
        /// </summary>
        bool IsClosed { get; }

        /// <summary>
        /// TRUE if BuyExecutedQty > SellExecutedQty
        /// </summary>
        bool IsLong { get; }

        /// <summary>
        /// TRUE if position are open on this symbol
        /// </summary>
        bool IsOpen { get; }

        /// <summary>
        /// TRUE if SellExecutedQty > BuyExecutedQty  
        /// </summary>
        bool IsShort { get; }

        /// <summary>
        /// Check if updated
        /// </summary>
        bool IsUpdated { get; }

        /// <summary>
        /// Check if is updating values
        /// </summary>
        bool IsUpdating { get; }

        /// <summary>
        /// LastUpdate Time
        /// </summary>
        DateTime LastUpdate { get; }

        /// <summary>
        /// Gets NetPL.
        /// </summary>
        double NetPL { get; }

        /// <summary>
        /// Return the market expo : Long - Short
        /// </summary>
        double NominalExpo { get; }

        /// <summary>
        /// Returns the nominal long = BuyExecutedQty * BuyAverageExecutedPrice
        /// </summary>
        double NominalLong { get; }

        /// <summary>
        /// Returns the nominal short = SellExecutedQty * SellAverageExecutedPrice
        /// </summary>
        double NominalShort { get; }

        /// <summary>
        /// Gets PL.
        /// </summary>
        double PL { get; }

        /// <summary>
        /// Gets Realized.
        /// </summary>
        double Realized { get; }

        /// <summary>
        /// Average price of executed sell orders
        /// </summary>
        double SellAverageExecutedPrice { get; }

        /// <summary>
        /// Cumulative quantity of executed sell orders
        /// </summary>
        int SellExecutedQty { get; }

        /// <summary>
        /// Gets UnRealized
        /// </summary>
        double UnRealized { get; }

        #endregion
    }
}